<template>
  <div id="app">
    <main>
     
      <div class="video" v-if="this.listData!=null">
            <my-video :sources="[{src:this.vediosrc,type:'video/mp4'}]" :options="video.options"></my-video>
        </div>
        <div class="video" v-else>
            <div class="none_data">
              <img src="../assets/img/tip.png" alt="">
              <p>暂无视频</p>
            </div>
        </div> 
    </main>
  </div>
</template>

<script type="text/ecmascript-6">
  import {
    EnterprisePropaganda
  } from '../api/api'
  
  import myVideo from 'vue-video'
  import {
    Toast
  } from 'mint-ui';
  export default {
    components: {
      myVideo,
    },
    data() {
      return {
        listData: {},
        vediosrc: '',
        showactive: '',
        video: {
          options: {
            volume: 0.6,
            poster: '../../static/img/vedio.png'
          }
        },
        vname: '',
      };
    },
    props: ["enterpriseUnid"],
    methods: {
      getData() {
        let options = {
          params: {
            unid: this.enterpriseUnid
          }
        }
        //调取接口
        EnterprisePropaganda(options).then((res) => {
          if (res.success === true) {
            this.listData = res.data;
            this.vediosrc = this.listData.file.serverFullPath;
            console.log(this.vediosrc)
          }
        })
      }
    },
    //页面加载时候
    created() {
      this.getData();
    }
  
  }
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->

<style lang="scss" scoped>
  object{
    width: 90%;
    margin: auto
  }
</style>
